package org.example.service.impl;

import org.example.datasource.TargetDataSource;
import org.springframework.stereotype.Service;

import org.springframework.beans.factory.annotation.Autowired;

import org.example.domain.InsertUniqueUnloggedTable;
import org.example.mapper.InsertUniqueUnloggedTableMapper;
import org.example.service.IInsertUniqueUnloggedTableService;
@Service
public class InsertUniqueUnloggedTableServiceImpl implements IInsertUniqueUnloggedTableService{

    @Autowired
    private InsertUniqueUnloggedTableMapper insertUniqueUnloggedTableMapper;

    @Override
    public int deleteByPrimaryKey(String smsId) {
        return insertUniqueUnloggedTableMapper.deleteByPrimaryKey(smsId);
    }

    @Override
    public int insert(InsertUniqueUnloggedTable record) {
        return insertUniqueUnloggedTableMapper.insert(record);
    }

    @Override
    public int insertSelective(InsertUniqueUnloggedTable record) {
        return insertUniqueUnloggedTableMapper.insertSelective(record);
    }

    @Override
    @TargetDataSource("pgDataSource")
    public int testInsertUnique(String smsId) {
        InsertUniqueUnloggedTable record = new InsertUniqueUnloggedTable();
        record.setSmsId(smsId);
        int insert = insertUniqueUnloggedTableMapper.insert(record);
        if(insert == 1){
            return 1;
        }
        return 0;
    }

}
